<!doctype html public "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
<html>
<head>
<title>
FlyUI Overview
</title>
<link rel ="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script>
function asd() {
	
		parent.document.title="maputils.js Overview";
	
}
</script>
</head>
<body bgcolor="white" onload="asd();">

<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
  <tr align="center" valign="top">
  
  
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
  <td bgcolor="#FFFFFF" class="NavBarCell1Rev">	&nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
  

  <td bgcolor="#FFFFFF" class="NavBarCell1"> 	<font class="NavBarFont1">Class</font>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
  </tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top">
<em>
<b>FlyUI</b></em>
</td>
</tr>

<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
  <a href="index.html" target="_top"><b>FRAMES</b></a>  &nbsp;
&nbsp;<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
&nbsp;&nbsp;
<script>
  <!--
  if(window==top) {
    document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
  }
  //-->
</script>
<noscript>
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->

<hr>
<center>
	
	   <h2>maputils.js</h2>
	
</center>

	


<h4>Summary</h4>
<p>
	
		This script defines map utilities.
 <BR/><BR/><B>Author:</B> <a href="http://freecode-freecode.blogspot.com/2007/06/hashmap-object-in-javascript-like.html">External Open Source</a>
 TODO license terms<BR/>
	
</p>

<hr>



<!-- ========== METHOD SUMMARY =========== -->

<!-- ========== END METHOD SUMMARY =========== -->


        <pre class="sourceview"><span class="comment">/**
 * <span class="attrib">@fileoverview</span>
 * This script defines map utilities.
 * <span class="attrib">@author</span> &lt;a href="http://freecode-freecode.blogspot.com/2007/06/hashmap-object-in-javascript-like.html"&gt;External Open Source&lt;/a&gt;
 * TODO license terms
 */</span>
 
<span class="comment">// create a namespace if not already defined</span>
flyui.namespace(<span class="literal">"flyui.maputil"</span>);

flyui.maputil.MapUtils = <span class="reserved">function</span>() {
    <span class="comment">// members</span>
    <span class="reserved">this</span>.keyArray = new Array(); <span class="comment">// Keys</span>
    <span class="reserved">this</span>.valArray = new Array(); <span class="comment">// Values</span>
        
    <span class="comment">// methods</span>
<span class="comment">//    this.put = put;</span>
<span class="comment">//    this.get = get;</span>
<span class="comment">//    this.size = size;  </span>
<span class="comment">//    this.clear = clear;</span>
<span class="comment">//    this.keySet = keySet;</span>
<span class="comment">//    this.valSet = valSet;</span>
<span class="comment">//    this.showMe = showMe;   // returns a string with all keys and values in map.</span>
<span class="comment">//    this.findIt = findIt;</span>
<span class="comment">//    this.remove = remove;</span>

	<span class="reserved">this</span>.put = <span class="reserved">function</span> ( key, val )
	{
	    var elementIndex = <span class="reserved">this</span>.findIt( key );
	    
	    <span class="reserved">if</span>( elementIndex == (-1) )
	    {
	        <span class="reserved">this</span>.keyArray.push( key );
	        <span class="reserved">this</span>.valArray.push( val );
	    }
	    <span class="reserved">else</span>
	    {
	        <span class="reserved">this</span>.valArray[ elementIndex ] = val;
	    }
	};

	<span class="reserved">this</span>.get = <span class="reserved">function</span> ( key )
	{
	    var result = null;
	    var elementIndex = <span class="reserved">this</span>.findIt( key );
	
	    <span class="reserved">if</span>( elementIndex != (-1) )
	    {   
	        result = <span class="reserved">this</span>.valArray[ elementIndex ];
	    }  
	    
	    <span class="reserved">return</span> result;
	};

	<span class="reserved">this</span>.remove = <span class="reserved">function</span> ( key )
	{
	    var result = null;
	    var elementIndex = <span class="reserved">this</span>.findIt( key );
	
	    <span class="reserved">if</span>( elementIndex != (-1) )
	    {
	        <span class="reserved">this</span>.keyArray = <span class="reserved">this</span>.keyArray.removeAt(elementIndex);
	        <span class="reserved">this</span>.valArray = <span class="reserved">this</span>.valArray.removeAt(elementIndex);
	    }  
	    
	    <span class="reserved">return</span> ;
	};

	<span class="reserved">this</span>.size = <span class="reserved">function</span> ()
	{
	    <span class="reserved">return</span> (<span class="reserved">this</span>.keyArray.length);  
	};

	<span class="reserved">this</span>.clear = <span class="reserved">function</span> ()
	{
	    <span class="reserved">for</span>( var i = 0; i &lt; <span class="reserved">this</span>.keyArray.length; i++ )
	    {
	        <span class="reserved">this</span>.keyArray.pop(); <span class="reserved">this</span>.valArray.pop();   
	    }
	};

	<span class="reserved">this</span>.keySet = <span class="reserved">function</span> ()
	{
	    <span class="reserved">return</span> (<span class="reserved">this</span>.keyArray);
	};

	<span class="reserved">this</span>.valSet = <span class="reserved">function</span> ()
	{
	    <span class="reserved">return</span> (<span class="reserved">this</span>.valArray);   
	}

	<span class="reserved">this</span>.showMe = <span class="reserved">function</span> ()
	{
	    var result = <span class="literal">""</span>;
	    
	    <span class="reserved">for</span>( var i = 0; i &lt; <span class="reserved">this</span>.keyArray.length; i++ )
	    {
	        result += <span class="literal">"Key: "</span> + <span class="reserved">this</span>.keyArray[ i ] + <span class="literal">"\tValues: "</span> + <span class="reserved">this</span>.valArray[ i ] + <span class="literal">"\n"</span>;
	    }
	    <span class="reserved">return</span> result;
	}

	<span class="reserved">this</span>.findIt = <span class="reserved">function</span> ( key )
	{
	    var result = (-1);
	
	    <span class="reserved">for</span>( var i = 0; i &lt; <span class="reserved">this</span>.keyArray.length; i++ )
	    {
	        <span class="reserved">if</span>( <span class="reserved">this</span>.keyArray[ i ] == key )
	        {
	            result = i;
	            break;
	        }
	    }
	    <span class="reserved">return</span> result;
	}

<span class="comment">//	this.removeAt( index )</span>
<span class="comment">//	{</span>
<span class="comment">//	  var part1 = this.slice( 0, index);</span>
<span class="comment">//	  var part2 = this.slice( index+1 );</span>
<span class="comment">//	</span>
<span class="comment">//	  return( part1.concat( part2 ) );</span>
<span class="comment">//	}</span>
<span class="comment">//	Array.prototype.removeAt = removeAt;</span>
}</pre>
	<hr>



<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
  <tr align="center" valign="top">
  
  
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
  <td bgcolor="#FFFFFF" class="NavBarCell1Rev">	&nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
  

  <td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
  </tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top"><em>
<b>FlyUI</b></em>
</td>
</tr>

<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
  <a href="index.html" target="_top"><b>FRAMES</b></a>  &nbsp;
&nbsp;<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
&nbsp;&nbsp;
<script>
  <!--
  if(window==top) {
    document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
  }
  //-->
</script>
<noscript>
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->

<hr>
<font size="-1">

</font>
<div class="jsdoc_ctime">Documentation generated by <a href="http://jsdoc.sourceforge.net/" target="_parent">JSDoc</a> on Tue Dec  9 11:08:18 2008</div>
</body>
</html>
